
		window.onload = function() {
		    //配置
		    var config = {
		        vx: 4,	//小球x轴速度,正为右，负为左
		        vy: 4,	//小球y轴速度
		        height: 2,	//小球高宽，其实为正方形，所以不宜太大
		        width: 2,
		        count: 200,		//点个数
		        color: "0,255,255", 	//点颜色
		        stroke: "75,0,130", 		//线条颜色
		        dist: 6000, 	//点吸附距离
		        e_dist: 20000, 	//鼠标吸附加速距离
		        max_conn: 10 	//点到点最大连接数
		    }

		    //调用
		    CanvasParticle(config);
		}

        // 选项卡
        tablecareSelect('.menus li','.menus-content div' )

// 二维码

let erWeiMa = document.querySelector('.erweima')
let ewm = document.querySelector('.ewm')

ewm.addEventListener('mouseover', function(){
    erWeiMa.style.height ='120px'
   
})

ewm.addEventListener('mouseout', function(){
    erWeiMa.style.height ='0px'
})

// 渲染将data的数据组装成代码 添加到xuanran1中

let data = [
    {"count": 4000, "price": 1200, "unitPrice": "0.3000"},
    {"count": 8000, "price": 2000,"unitPrice": "0.2500" },
    {"count": 40000, "price": 8000, "unitPrice": "0.2000" }
   ]

let dataHtml = '' //保存数据
//    遍历数组

let xuanran = document.querySelector('.xuanran1')


data.forEach(function(v,i){
    dataHtml  +=`
    <span class="idcard-text-icon2 ${i ===0 ? 'active2' : ''}" data-price="${v.price}" data-unit-price ="${v.unitPrice}">${v.count}次</span>
    `
   
})
xuanran.innerHTML += dataHtml 


// 给渲染数据添加激活按钮

xuanran.addEventListener('click', function(e){
   let bool = e.target.nodeName === 'SPAN' && e.target.className != 'idcard-text-icon ewm';

   
   if (bool) {
    for(let i = 1; i< xuanran.children.length ; i++){
        xuanran.children[i].className = 'idcard-text-icon2'
    }
    e.target.classList.add('active2')
 }
    
 // 给渲染自定义数据添加激活按钮
let moneyAll = document.querySelector('.moneyAll')
let money = document.querySelector('.money')

moneyAll.textContent = e.target.dataset.price
money.textContent =e.target.dataset.unitPrice
})


